<include file="public@header"/>

</head>
<body>
<style>
    #btn{
        padding: 2rem;
    }
</style>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="">产品列表</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('admin/goods/index')}" _lpchecked="1">
        类型:
        <select name="type" class="form-control"  id="">
            <option  value="">全部</option>
            <navigation nav-id="3">
                <option  value="{$menu.id}">{$menu.name}</option>
            </navigation>
        </select>
        <button class="btn btn-primary">搜索</button>
    </form>
    <table class="table table-bordered margin-top-20">
        <thead>
        <tr>
            <th>{:lang('排序')}</th>
            <th>编号</th>
            <th>名称</th>
            <th>价格</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="$data" id="vo">
            <tr>
                <td style="width: 4%" data-id="{$vo.g_id}">
                    <input type="text" value="{$vo.sort}" class="list-sort">
                </td>
                <td  style="width: 10%;">{$vo.g_id}</td>
                <td  style="width: 10%;">{$vo.g_name}</td>
                <td  style="width: 10%;">{$vo.basics_money}</td>
                <td  style="width: 10%;">{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
                <td width="15%">
                    <a href="{:url('admin/goods/addKP',['g_id'=>$vo['g_id']])}">添加卡密</a>
                   <!-- <a href="">查看卡密</a>-->
                    <a href="{:url('admin/goods/delGoods',['id'=>$vo['g_id']])}" class="js-ajax-delete" data-msg="确定删除它吗？,他会自动把没有没出的卡密也删除">删除产品</a>
                    <a href="{:url('admin/goods/addgoods',['id'=>$vo.g_id])}">编辑产品</a>
                    <a href="{:url('admin/goods/lockkp',['goods_id'=>$vo.g_id])}">查看卡密</a>
                    <a href="javascript:;" data-id="{$vo.g_id}" class="dao-chu">导出卡密</a>
                </td>

            </tr>
        </volist>

        </tbody>
    </table>
    <ul class="pagination">
        {$data->render()}
    </ul>
</div>

</body>
</html>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer\layer.js"></script>
<script>
    $(function () {
        $('.dao-chu').click(function () {
            var $this = $(this);
            layer.open({
                type:2,
                area:['500px','500px'],
                content:'{:cmf_url("derive")}?goods_id='+$this.data('id')
            })
        });
        
        $('.list-sort').change(function () {
            $.post('{:cmf_url("update_sort")}',{
                id:$(this).parent().data('id'),
                sort_val:$(this).val()
            },function (da) {
                layer.msg(da.msg);
                da.code && location.reload();
            })
        })
    })
</script>